import java.util.Arrays;

/**
 * @author wangj881
 * @date 2024-10-02 10:39
 */
public class L1365 {

    public static void main(String[] args) {
        int[] nums = {8, 1, 2, 2, 3};
        int[] ints = new Solution().smallerNumbersThanCurrent(nums);
        System.out.println(Arrays.toString(ints));
    }

    static class Solution {
        public int[] smallerNumbersThanCurrent(int[] nums) {
            int[] ints = new int[nums.length];
            int count = 0;
            for (int i = 0; i < nums.length; i++) {
                for (int j = 0; j < nums.length; j++) {
                    if (j == i) {
                        continue;
                    }
                    if (nums[j] < nums[i]) {
                        count++;
                    }
                }
                ints[i] = count;
                count = 0;
            }
            return ints;
        }
    }
}
